<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    // console
    const p1 = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve('p1p1p1')
      }, 2000)
    })

    const p2 = new Promise((resolve, reject) => {
      setTimeout(() => {
        reject('p2p2p2')
      }, 1000)
    })
    const p3 = Promise.resolve('p3p3p3p3')

    const promiseAll = Promise.all([p1, p2, p3])
    promiseAll
      .then((res) => console.log('Promiseall--success', res))
      .catch((err) => console.log('Promiseall--error', err))

    const promiseRace = Promise.race([p1, p2, p3])
    promiseRace
      .then((res) => console.log('promiseRace-success', res))
      .catch((error) => console.log('promiseRace--error', error))

    const promiseAllSet = Promise.allSettled([p1, p2, p3])
    promiseAllSet.then((res) => console.log('promiseAllSet-success', res))
  </script>
</html>
